package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.MethodInstructionBytecodeEvent;

public class MethodInstructionBytecodeEventImpl extends BytecodeEventImpl implements MethodInstructionBytecodeEvent
{
    private int opcode;
    private String ownerName;
    private String methodName;
    private String methodDescriptor;

    public MethodInstructionBytecodeEventImpl(final int aOpcode, final String aOwnerName, final String aMethodName,
        final String aMethodDescriptor)
    {
        opcode = aOpcode;
        ownerName = aOwnerName;
        methodName = aMethodName;
        methodDescriptor = aMethodDescriptor;
    }

    @Override
    public int getType() {
        return METHOD_INSTRUCTION;
    }

    @Override
    public void setOpcode(final int aOpcode) {
        opcode = aOpcode;
    }

    @Override
    public int getOpcode() {
        return opcode;
    }

    @Override
    public void setOwnerName(final String aOwnerName) {
        ownerName = aOwnerName;
    }

    @Override
    public String getOwnerName() {
        return ownerName;
    }

    @Override
    public void setMethodName(final String aMethodName) {
        methodName = aMethodName;
    }

    @Override
    public String getMethodName() {
        return methodName;
    }

    @Override
    public void setMethodDescriptor(final String aMethodDescriptor) {
        methodDescriptor = aMethodDescriptor;
    }

    @Override
    public String getMethodDescriptor() {
        return methodDescriptor;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitMethodInstruction(this);
        return aBytecodeVisitor;
    }
}
